package dji.ux.ext.panel.camera;

import androidx.annotation.NonNull;

import dji.sdk.camera.Camera;
import dji.sdk.sdkmanager.DJISDKManager;
import dji.ux.beta.base.DJISDKModel;
import dji.ux.beta.base.WidgetModel;
import dji.ux.beta.base.uxsdkkeys.ObservableInMemoryKeyedStore;


/**
 * Widget Model for the {@link CameraFunctionModel} used to define
 * the underlying logic and communication
 */
class CameraFunctionModel extends WidgetModel {

    CameraFunctionModel(@NonNull DJISDKModel djiSdkModel,
                        @NonNull ObservableInMemoryKeyedStore keyedStore) {
        super(djiSdkModel, keyedStore);
    }

    boolean isH20TCamera() {
        if (DJISDKManager.getInstance().getProduct() == null ||
                DJISDKManager.getInstance().getProduct().getCameras() == null)
            return false;

        boolean isH20TCamera = false;
        for (Camera camera : DJISDKManager.getInstance().getProduct().getCameras()) {
            if (camera.getDisplayName().equals(Camera.DisplayNameZenmuseH20T) ||
                    camera.getDisplayName().equals(Camera.DisplayNameZenmuseH20)) {
                isH20TCamera = true;
                break;
            }
        }

        return isH20TCamera;
    }

    boolean isMavic2DualCamera() {
        if (DJISDKManager.getInstance().getProduct() == null ||
                DJISDKManager.getInstance().getProduct().getCameras() == null)
            return false;

        boolean isMavic2DualCamera = false;
        for (Camera camera : DJISDKManager.getInstance().getProduct().getCameras()) {
            if (camera.getDisplayName().equals(Camera.DisplayNameMavic2EnterpriseDual_IR)) {
                isMavic2DualCamera = true;
            }
        }

        return isMavic2DualCamera;
    }

    @Override
    protected void inSetup() {

    }

    @Override
    protected void inCleanup() {
        //Nothing to cleanup
    }

    @Override
    protected void updateStates() {
        //Nothing to update
    }


}
